home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
programs.arc
/
D_CURVE.PRO
next >
Wrap
Text File
|
1986-10-07
|
802b
|
37 lines
check_determ
/*
Dragon curve program from "LISP" Wenston & Horn. This is a graphocs
program and requires a CGA or EGA color card.
*/
database
root2(real)
predicates
dragon(real, integer, integer)
int_real(integer, real)
goal
R = sqrt(2.0),
assertz(root2(R)),
graphics(1,2,112), /* change attributes for clarity on your PC*/
penpos(4500, 18000, 180),
dragon(15000.0, 0, -1).
clauses
dragon(L, A, Sign) :-
L > 150.0,
root2(R),!,
L1 = L / R,
A1 = A + 45 * Sign, A2 = A - 45 * Sign,
!,dragon(L1, A1, 1),!,dragon(L1, A2, -1).
dragon(L, A, _) :-
penpos(X, Y, _),
penpos(X, Y, A),
random(CR), C=CR*7+1, int_real(Co,C),
pencolor(Co),
int_real(Len, L),
forward(Len).
int_real(I, R) :-
I=R.